using UnityEngine;

public class LeaderboardsButton : MonoBehaviour
{
	public LeaderboardsLayer leadLayer;

	public NewLeaderboardLayer newLeadLayer;

	public UILabel thisLabel;

	public Color active = new Color(0.078f, 0.216f, 0.302f, 1f);

	public Color inactive = new Color(0.255f, 0.596f, 0.808f, 1f);

	private UIWidget thisWidget;

	private UIButton thisButton;

	private int thisId;

	public void InitButton(string buttonName, int buttonId, bool isActive)
	{
		thisWidget = GetComponent<UIWidget>();
		thisButton = GetComponent<UIButton>();
		thisId = buttonId;
		UITools.ChangeText(thisLabel, buttonName);
		thisWidget.color = ((!isActive) ? inactive : active);
		thisButton.defaultColor = ((!isActive) ? inactive : active);
		thisButton.UpdateColor(true, true);
	}

	public void OnClick()
	{
		if (leadLayer != null)
		{
			leadLayer.OnTabButtonClick(thisId);
		}
		if (newLeadLayer != null)
		{
			newLeadLayer.OnTabButtonClick(thisId);
		}
		thisWidget.color = active;
		thisButton.defaultColor = active;
		thisButton.UpdateColor(true, true);
	}

	public void Deactivate()
	{
		thisWidget.color = inactive;
		thisButton.defaultColor = inactive;
		thisButton.UpdateColor(true, true);
	}
}
